#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution {
public:
    vector<vector<int>> largeGroupPositions(string s) {
        vector<vector<int>> result;
        vector<char> temp;
        for(int i = 0;i<s.size();++i){
            if(temp.empty()||temp.back()==s[i]){
                temp.push_back(s[i]);
            }
            else{
                if(temp.size()>=3){
                    result.push_back({i-int(temp.size()),i-1});
                }
                temp = vector<char>();
                temp.push_back(s[i]);
            }
        }
        if(temp.size()>=3){
            result.push_back({int(s.size())-int(temp.size()),int(s.size())-1});
        }
        return result;
    }
};


int main(){
    Solution S;
    vector<vector<int>> result = S.largeGroupPositions("abcdddeeeeaabbbcd");
    return 0;
}